home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
United Public Domain Gold 2
/
United Public Domain Gold 2.iso
/
utilities
/
pu173.dms
/
pu173.adf
/
Docs
/
NoDelete.doc.pp
/
NoDelete.doc
Wrap
Text File
|
1992-03-20
|
18KB
|
364 lines
*************************************************************************
* NoDelete V2.01 (C) HooverSoft Feb 1992 *
*************************************************************************
PREFACE
Well, I'm back. I have been quite busy during 1991 which left me with
little time to work on this program (things like becoming a father of a baby
boy, getting on with my studies and moving places twice). Some people
suggested that NoDelete still needed lots of work before it would be what
I'd call a really nice little hack, and so Version 2.01 (the current one)
includes several new features. The biggest changes were done in the string
handling routines. Patterns can now be any length up to 255 characters, but
I hope no ones uses file name monsters like these, and up to fifty patterns
can be selected. Furthermore it is now possible to interactively edit (or
wipe out) patterns in a string gadget while NoDelete is running which will
be made the active patterns once RETURN is pressed. For more information,
please see below.
WHY USE NODELETE?
NoDelete can literally save you hours of work. Days of work! Months of
work! I'm not exaggerating. :-) If NoDelete is installed on your system,
you will be asked to confirm *any* attempt to delete a file on any AmigaDOS
disk device, and this means not just deletions that you choose to make while
working with the Shell, but also for any other program running in background
or trying to do other nasty things. Say you've been working for months on
the file 'WormSpace.tex', a paper describing just how time travel can be
made possible. You finish your work on Friday 13th of Jan, 2001 and before
you go to sleep through what's left of the night you decide to wipe all
these ugly .log and .aux files that TeX leaves lying around. Being half
blinded by fatigue, you type 'delete *.*' and unsuspectingly press <RETURN>.
Now, this might be the right time to shoot yourself if it hadn't been for
NoDelete which will ask you if you *really* *really* really* want to delete
those precious TeX sources. Should the above (fictuous) sitution become
true, please send me 1% of your Nobel prize :-) or at least a nice 68040
board. :-)
You will also benefit from NoDelete if you're not in for the Nobel prize.
If you're willing to be called 'traitor' by honest nethack players, then
read on: You can keep NetHack from constantly deleting those precious save
files.
WHAT IT DOES
NoDelete enables you erraneous humans to once again reflect on the
righteousness of your decisions concerning the deleting of files on
AmigaDos devices. If you try to delete a file or a program tries to remove
it, this is mostly done via DeleteFile() of the dos.library. When
executed, NoDelete bends this vector to its own routine which brings up
this cute little requester on the active window. This requester contains
the name of the file that the system is trying to delete. If you really
want to delete this file, click to the "Yes, Delete!" gadget. If not,
click to the "Oops, no way!"-Gadget of the requester. NoDelete works just
fine with aliases, wildcards etc. For problems see the "known
bugs"-section of this text.
PATTERNS
Lots of programs, programmers and normal people use patterns in their file
system to be able to immediately make out the contents of a file. For
example, ".c" specifies the file to be a C source code and ".bas" should
contain a basic program's source. There are tons of frequently used
extensions, from ".asm" up to ".cfg". If you use NoDelete and you don't
want the system to get on your nerves by confirming EVERY rm command, you
should use a certain extension on NoDelete's command line to tell NoDelete
that it should only ask confirmation for those precious ".c" or ".iff"
files and let all others alone.
The new version of NoDelete also supports complete filenames as pattern
matching is done via PatternMatch() of ARP. The command line
1> run nodelete *.c
would tell NoDelete to only intercept the removing of files ending in ".c"
and not to worry about any other files that are being deleted on the device.
You can specifiy up to fifty patterns of abitrary length when
running NoDelete. The command
1> run NoDelete *.c *.iff *.tex *.asm *.sav
will make NoDelete complain about any file being deleted which ends in one
of the specified patterns and leave all others alone. If you have forgotten
which patterns you specified at startup, just activate NoDelete's titlebar
and press <SPACE>. NoDelete will then give a list of patterns in the
titlebar until another key is pressed.
Another one:
1> run NoDelete Peter Pecker picked a pepper
would intercept any attempt to remove the files peter, pecker, picked, a,
and pepper. If the extensions get too long to fit into the titlebar, press
'e' for edit instead of <SPACE>. This will bring up a little window with a
string gadget in it so you can scroll through the patterns selected. If you
don't want to edit any of these, use the close gadget of the window to
remove it, and no changes will be made to the active patterns. Only if you
press <RETURN> with the string gadget active the string entered will be
parsed and the new patterns be set. To make things totally clear, let me
cite the ARP programmer's manual:
CITE
arp.doc/PatternMatch (V31)
NAME
PatternMatch - perform a wildcard match on a string
SYNOPSIS
result = PatternMatch(pat,str)
D0 A0 A1
FUNCTION
This function compares a string to the given pattern and determines
if it is a valid match. If so it returns a true result.
The pattern must be constructed with special preparsed tokens and
supports the following patterns:
(p1|p2|p3) One of the patterns p1, p2 or p3
? Any single character
#<pat> Pattern repeated 0 or more times
[class] Character class
[^class] Negated character class
{pat} Structure tag for replacement
* 0 or more occurances of any character
INPUTS
char *pat The pattern string to match against
char *str The string to be matched
RESULT
result - a boolean value indicating success/failure. The condition
codes are guarenteed to reflect the status of the result
BUGS
None known.
SEE ALSO
Author: JAT
END CITE
Right? So far for all the wildcards you can use with ARP. IMPORTANT NOTE:
if you work with Csh or WB 1.3 shell, you will have to escape the
characters special to these shells, respectively. To protect all C sources
while in Csh, you would use the syntax
$ run nodelete \*.c
to have the special shell wildcard "*" survive on its way to NoDelete.
PROTECTING ENTIRE DIRECTORIES
If you want NoDelete to protect entire directories on your disk, use
something like
1> run NoDelete s:* dh0:s/*
to prevent any program deleting files residing in the S: directory. NOTE:
this will not work if the current directory of the process attempting to
delete a file happens to be S:. This is due to the fact that a program that
has its current directory set to s: usually only passes the filename to
DeleteFile() and not the complete pathname.
COMMAND LINE OPTIONS
The folowing is a list of command line options that can be used when
invoking NoDelete from the CLI:
-p number where number is an integer between -20 and 9. If given on
the command line, NoDelete will set its priority to this
value. If you type rubbish or use values not allowed, the
default priority of -5 is set.
-y ypos where ypos is an integer ranging from zero to 245 (sorry,
all you NTSC users...). This number will determine the ver-
tical position of NoDelete's titlebar. if you try to fool
NoDelete or do not give this option, the default value zero
(top of screen) is used.
-O Override file protection bit. If this option is given,
NoDelete will NOT care about the file's protection status.
This option is sort of dangerous, but I think if you are
explicitly asked wether you want to delete a file this
should be presto! wiped off the disk without return or
any other chance of survival..., Anyway, the default now
is to consider and respect the file protection.
-S if given, this option tells NoDelete to shut up. No screams,
no comments!
KEY COMMANDS WITH NODELETE WINDOW ACTIVE
There are a couple of commands that NoDelete understands if its window is
active. Just press the key displayed in the left column to activate the
command. The following is a list of currently implemented keys:
<SPACE> GIVE A LIST OF CURRENTLY ACTIVE PATTERNS. If the list of
patterns is longer than the window title, only the first few
patterns fitting into the bar will be displayed.
c CLEAR CURRENTLY ACTIVE PATTERNS. This means that from now on
all attempts to delete files will be moaned about and not
just those that matched the previously active patterns.
You can see by NoDelete's Titlebar displaying 'NO PAT' at the
end that every DeleteFile() call will be intercepted.
e EDIT PATTERNS. This function lets you edit the active patterns
it brings up a litte window with a string gadget displaying the
patterns that are active. If none were active before, an empty
string will be displayed. Enter and edit new patterns or delete
old ones to your heart's content and then press <ENTER> to
activate the newly edited ones. If you decide that you'd rather
keep the old ones, use the CLOSE gadget of the window to get
them back.
q QUIT. This is just a shorthand for closing down NoDelete. It
has the same effect as clicking on the Close gadget of the
window.
RUNNING NODELETE FROM THE WORKBENCH
An icon is supplied in this archive to enable you to launch NoDelete from
the Workbench. When you do so, all settings like the vertical positon of
the window and the priority will be set to their default values and NoDelete
will come up with no patterns set. Should you want to use patterns, edit
them interactively as described above.
KNOWN BUGS
The Shell won't complain if you try to delete any non-existent file while
NoDelete has its grip on the system. This is not really a bug because
NoDelete works on this basis of cheating the calling function and
pretending that everything is just fine and deleted. This also is the
cause that the calling program will not be informed if the file in question
is delete protected.
THE LEGAL STUFF
NoDelete is FreeWare and may be copied freely by everyone except for
purposes listed below as long as this notice is left intact. This program
is copyright (C) by HooverSoft. It may NOT be copied or sold for commercial
purposes without written permssion by the author (Get lost, Carsten Wolf and
all you other sharks!). It may be distributed and copied freely for
non-commercial purposes only. Express permission to distribute NoDelete
with the AmigaLibDisks is given to Fred Fish (cheers, mate! :-).
When distributed, this program should always be accompanied by this file,
the documentation. The price of the distribution disk may not surpass 5
German Marks or the equivalent in any foreign currency.
Should you feel the urgent need to reward the efforts of the author in
writing this thing, feel free to make a donation to your favourite charity
like Greenpeace or some similar organization attempting to do something
about the destruction of this planet. Please don't forget that the worlds
this fantastic computer creates aren't real...please drop me a line if you
have made a donation. This will make programming even more rewarding for
me.
FURTHER PLANS & HOPELESS DREAMS
I would like to use CreateTask() to launch a separate Task for Nodelete.
This would unlink NoDelete's memory requirements from the current stacksize
of the system. Someone willing to tell us how to answer AutoRequest()s by
keystrokes? I'm listening!
CREDITS
I'm very thankful to all those people who have continued to make their
sources available through FreeWare, especially Fred Fish, Udo K Schuermann
(The walrus and maintainer of Akvarium Data Files) and Matt Dillon. See
this project as an attempt to pay the debt that I owe to you. Many "thank
you"'s go to Bernd Heide for drawing the NoDelete icon.
PUBLIC FEEDBACK
Bug reports (cheers, Jensi & John & David & Holger & & &...+ all the others
too numerous to mention), criticism, comments and approvements should be
sent to
SNAIL:
HooverSoft Inc.
Joellenbecker Weg 4
D-4900 Herford
Germany
INTERNET:
hoover@math20.mathematik.uni-bielefeld.de
Actually, you can reach me on any host from math[1-22] of the above address,
just select the one that's not currently out of action. ;-)
DISCLAIMER
Do whatever you like with this program, but listen: you can't blaim it on
me if anything goes down the drain!
HISTORY
CHANGES TO VERSION 1.51: FEB 1992
The jump in the version number might seem a bit too high, but V1.51 was
posted to comp.sources.amiga but somehow never got through. There's been a
lot of work done on this program, so I had to push up the Release number
like that. Changes include interactive pattern editing, dynamical memory
allocation for patterns, a bug fix with the SetTaskPri() call and lots of
other things. Another bug in previous versions would allow you to close
down NoDelete even if a requester was active. Result: -> Crash. This has
also been fixed.
CHANGES TO VERSION 1.5: MAY 1991
Due to public request I've tried to make NoDelete Kick2.0-compatible.
NoDelete will now check for a version number of dos.library >=36 and then
make the appropriate changes in the jump table.
The check to see if NoDelete is already installed is now made via a
FindPort(). If NoDelete is installed, a port named 'nd_port' will be
hanging around in your system. Just don't worry, this is not a new virus.
Furthermore a bug was killed in the command line parse & the source was
freed of some nasty words some people might have found offensive...:-)
CHANGES TO VERSION 1.4: MAR 1991
Switched to ARP (finally). This great bunch of routines should have
experienced a wide enough distribution by now to make this acceptable.
Cheers to everyone involved in this project! ARP is used to do the pattern
matching on filenames. No more restriction is made on the patterns. They
can be complete filenames or just patterns, with every ARP wildcard
allowed. I forgot the name of the guy who suggested this one, and answers
by UUCP is not a favourite of math4.unibi.de. Anyway, as soon as this is
implemented, you'll get a "thank you", mate!
CHANGES TO VERSION 1.35: OCT 1990
Programmed two new options -O and -S (Cheers, John!). These options sort
of "fix" a bug with NoDelete which used to override the file protection
bit.
CHANGES TO VERSION 1.3: SEP 1990
Lots of changes. Thinking of writing a new documentation. Anyway,
introduced command line options -p and -y for run-time setting of priority
of NoDelete and of vertical position of titlebar.
CHANGES TO VERSION 1.2: AUG 1990
Introduced the possibilty to give multiple patterns on startup. Lists
patterns when pressing a key while Nodelete's titlebar is active.
CHANGES TO VERSION 1.1: AUG 1990
NoDelete now automatically centers the Dragbar on Screen and calculates the
correct width for the window if a pattern is specified.
Now works fine with AmiOmega. System won't crash if "Yes, Delete!" is
selected.
Now supports the use of patterns to ask confirmations only for special
files ending in defined pattern. Will show the selected pattern in
window's titlebar.
NoDelete now checks if another NoDelete is already active and exits if
true.
CHANGES TO VERSION 1.01: JUL 1990
Now handles protected Files correctly. Previous version didn't complain if
file was delete protected.
NoDelete sets its priority to a value of -5 directly after startup.
CHANGES TO VERSION 1.00: JUN 1990
Version 1.01 now restores the Dos Vector relative to _DosBase, so this
program should work under Kickstart 1.3 as well. If someone already uses
Kick 2.0, he or she should let me know if NoDelete works with that. I have
heard that the funny instructions in DosBase have been replaced with a
regular jump table.
Have fun,
Hoover